package com.app.configuration.web.mvc;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 系统访问的默认路径设置
 * @author chenl
 *
 */
@Configuration
public class WebMvcViewControllerConfiguration  implements WebMvcConfigurer {
	

	@Value("${sysConfig.defaultIndex}")
	private String defaultIndex;			//系统访问的默认路径

	@Override
    public void addViewControllers(ViewControllerRegistry registry) {
    	// TODO Auto-generated method stub
		registry.addViewController("/").setViewName("forward:" + defaultIndex);
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
        
    	WebMvcConfigurer.super.addViewControllers(registry);
    }    
	
}
